<template>
  <!--  方式一：直接使用组件 -->
  <div class="analysis-panel">
    <AnalysisToolbar />
  </div>

  <!--方式二：使用 useAnalysis 组合函数  -->
  <div class="profilepanel">
    <button @click="activate(AnalysisType.Profile)">剖面分析</button>
    <button @click="clearAllAnalysis">清除</button>
  </div>
</template>
<script setup lang="ts">
import { onMounted } from 'vue';
import AnalysisToolbar from '@/components/AnalysisToolbar.vue';

const { __viewer } = window;

// import { ProfileTools } from '@/utils/ProfileTools';
// import { Tooltip } from '@/utils/tooltips/impl/Tooltip';
// import {SuperMap3D} from "@/utils/supermap3d";
// let analysis: ProfileTools;

const viewer = __viewer;
import { useAnalysis } from '@/composables/useAnalysis';
import { AnalysisType } from '@/utils/analysis/AnalysisTools';
const { activateAnalysis, clearAllAnalysis } = useAnalysis(viewer);

function activate(type: AnalysisType) {
  activateAnalysis(type);
}

onMounted(() => {
  // const profile = new SuperMap3D.Profile(__viewer.scene); // 确保已正确初始化 Profile
  // analysis = new ProfileTools(__viewer, profile, new Tooltip());
});
</script>
<style scoped>
.analysis-panel {
  position: absolute;
  left: 30px;
  top: 200px;
  z-index: 3;
}
</style>
